package inventory.view;

import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.JSeparator;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

public class InventoryReport extends JPanel {
	private JTable table;
	public InventoryReport() {
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		JLabel lblCatego = new JLabel("Category:");
		springLayout.putConstraint(SpringLayout.NORTH, lblCatego, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, lblCatego, 10, SpringLayout.WEST, this);
		add(lblCatego);
		
		JLabel lblMaterial = new JLabel("Material :");
		springLayout.putConstraint(SpringLayout.NORTH, lblMaterial, 0, SpringLayout.NORTH, lblCatego);
		springLayout.putConstraint(SpringLayout.WEST, lblMaterial, 133, SpringLayout.EAST, lblCatego);
		add(lblMaterial);
		
		JComboBox comboBox = new JComboBox();
		springLayout.putConstraint(SpringLayout.NORTH, comboBox, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, comboBox, 6, SpringLayout.EAST, lblCatego);
		springLayout.putConstraint(SpringLayout.EAST, comboBox, 77, SpringLayout.EAST, lblCatego);
		add(comboBox);
		
		JComboBox comboBox_1 = new JComboBox();
		springLayout.putConstraint(SpringLayout.NORTH, comboBox_1, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, comboBox_1, 6, SpringLayout.EAST, lblMaterial);
		springLayout.putConstraint(SpringLayout.EAST, comboBox_1, 77, SpringLayout.EAST, lblMaterial);
		add(comboBox_1);
		
		JSeparator separator = new JSeparator();
		springLayout.putConstraint(SpringLayout.WEST, separator, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, separator, 62, SpringLayout.SOUTH, comboBox);
		springLayout.putConstraint(SpringLayout.EAST, separator, -10, SpringLayout.EAST, this);
		add(separator);
		
		JButton btnSubmit = new JButton("SUBMIT");
		springLayout.putConstraint(SpringLayout.SOUTH, btnSubmit, -583, SpringLayout.SOUTH, this);
		springLayout.putConstraint(SpringLayout.NORTH, separator, 6, SpringLayout.SOUTH, btnSubmit);
		springLayout.putConstraint(SpringLayout.WEST, btnSubmit, 181, SpringLayout.WEST, this);
		add(btnSubmit);
		
		JLabel lblDate = new JLabel("Date :");
		springLayout.putConstraint(SpringLayout.WEST, lblDate, 24, SpringLayout.EAST, comboBox_1);
		springLayout.putConstraint(SpringLayout.SOUTH, lblDate, 0, SpringLayout.SOUTH, lblCatego);
		add(lblDate);
		
		JLabel lblNewLabel = new JLabel("mm/dd/yyyy");
		springLayout.putConstraint(SpringLayout.NORTH, lblNewLabel, 0, SpringLayout.NORTH, lblCatego);
		springLayout.putConstraint(SpringLayout.WEST, lblNewLabel, 6, SpringLayout.EAST, lblDate);
		add(lblNewLabel);
		
		JScrollPane scrollPane = new JScrollPane();
		springLayout.putConstraint(SpringLayout.NORTH, scrollPane, 13, SpringLayout.SOUTH, separator);
		springLayout.putConstraint(SpringLayout.WEST, scrollPane, 0, SpringLayout.WEST, lblCatego);
		springLayout.putConstraint(SpringLayout.SOUTH, scrollPane, 540, SpringLayout.SOUTH, separator);
		springLayout.putConstraint(SpringLayout.EAST, scrollPane, 599, SpringLayout.WEST, this);
		add(scrollPane);
		
		JButton btnPrint = new JButton("PRINT");
		springLayout.putConstraint(SpringLayout.NORTH, btnPrint, 6, SpringLayout.SOUTH, scrollPane);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
				{null, null, null, null, null, null},
			},
			new String[] {
				"SR. NO", "NAME", "SPECIFCATION", "BALANCE", "RATE", "AMOUNT"
			}
		));
		table.getColumnModel().getColumn(1).setPreferredWidth(120);
		table.getColumnModel().getColumn(2).setPreferredWidth(104);
		scrollPane.setViewportView(table);
		springLayout.putConstraint(SpringLayout.EAST, btnPrint, -251, SpringLayout.EAST, this);
		add(btnPrint);
	}
}
